package com.bugsnag.ohos;

/**
 * ContextState
 *
 * @since 2021-07-01
 */
public class ContextState extends BaseObservable {
    private String context;

    /**
     * constructor
     */
    public ContextState() {
        setContext(null);
    }

    /**
     * constructor
     *
     * @param context
     */
    public ContextState(String context) {
        setContext(context);
    }

    public String getContext() {
        return context;
    }

    /**
     * set context
     *
     * @param context
     */
    public void setContext(String context) {
        this.context = context;
        emitObservableEvent();
    }

    /**
     * emitObservableEvent
     */
    public void emitObservableEvent() {
        updateState(new StateEvent.UpdateContext(context));
    }

    ContextState copy() {
        return new ContextState(context);
    }
}
